home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / Other Langs / Tickle-4.0 (tcl) / library / help / tcl / files / glob < prev    next >
Encoding:
Text File  |  1993-10-26  |  2.3 KB  |  57 lines  |  [TEXT/$Tcl]

  1.  
  2.           glob ?switches? pattern ?pattern ...?
  3.  
  4.  
  5.      DESCRIPTION
  6.           This command performs file name ``globbing''  in  a  fashion
  7.           similar  to  the  csh shell.  It returns a list of the files
  8.           whose names match any of the pattern arguments.
  9.  
  10.           If the initial arguments to glob start with - then they  are
  11.           treated  as  switches.  The following switches are currently
  12.           supported:
  13.  
  14.           -nocomplain    Allows an empty list to be  returned  without
  15.                          error;   without  this  switch  an  error  is
  16.                          returned if the result list would be empty.
  17.  
  18.           --             Marks the end of switches.  The argument fol-
  19.                          lowing  this one will be treated as a pattern
  20.                          even if it starts with a -.
  21.  
  22.           The pattern arguments may contain any of the following  spe-
  23.           cial characters:
  24.  
  25.           ?         Matches any single character.
  26.  
  27.           *         Matches any sequence of zero or more characters.
  28.  
  29.           [chars]   Matches any single character in chars.   If  chars
  30.                     contains a sequence of the form a-b then any char-
  31.                     acter between a and b (inclusive) will match.
  32.  
  33.           \x        Matches the character x.
  34.  
  35.           {a,b,...} Matches any of the strings a, b, etc.
  36.  
  37.           As with csh, a  ``.'' at the beginning of a file's  name  or
  38.           just  after  a ``/'' must be matched explicitly or with a {}
  39.           construct.   In  addition,  all  ``/''  characters  must  be
  40.           matched explicitly.
  41.  
  42.           If the first character in a pattern is ``~'' then it  refers
  43.           to  the  home  directory for the user whose name follows the
  44.           ``~''.  If the ``~'' is followed immediately by  ``/''  then
  45.           the value of the HOME environment variable is used.
  46.  
  47.           The glob command differs from  csh  globbing  in  two  ways.
  48.           First,  it does not sort its result list (use the lsort com-
  49.           mand if you  want  the  list  sorted).   Second,  glob  only
  50.           returns  the  names of files that actually exist;  in csh no
  51.           check for existence is made unless a pattern contains  a  ?,
  52.           *, or [] construct.
  53.  
  54.  
  55.      KEYWORDS
  56.           exist, file, glob, pattern
  57.